#include "DKInclude.h"

DKActorLazerMachine::DKActorLazerMachine() : DKActor()
{
	this->imagePath = ccs("lazer_machine_up.png");
	this->actorName = ccs("Lazer Machine");
	this->zIndex = 10;
	this->movingVelocity = 3;
}

DKActorLazerMachine::~DKActorLazerMachine()
{

}

void DKActorLazerMachine::startMachine(CCObject *map)
{
	this->map = map;
	this->schedule( schedule_selector(DKActorLazerMachine::generateLazer), 1/20 * this->movingVelocity );
}

void DKActorLazerMachine::generateLazer(float dt)
{
	DKActorLaser *lazer = (DKActorLaser *)dka(5, this->location.XIndex, this->location.YIndex);
	lazer->direction = this->direction;
	((DKMap *)this->map)->addActor(lazer);

	DKEvent *evt = new DKEvent(lazer, DKEventType_Push, lazer->direction);
	lazer->BePushed(evt, this->map);
	//lazer->moveAsDirection(lazer->direction);
}
